package cn.glc.daily.life.web.service.captcha.abs;


import cn.glc.daily.life.model.dto.SendCodeDto;

/**
 * 验证码发送抽象接口
 *
 * @author simon
 * @date 2020/6/1 16:15
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
public abstract class AbstractSendCode {

    /**
     * 参数校验
     *
     * @param sendCode
     * @return
     */
    protected boolean vail(SendCodeDto sendCode) {
        return false;
    }

    /**
     * 手机验证码/邮箱验证码发送
     *
     * @param sendCode
     * @return
     */
    protected boolean send(SendCodeDto sendCode) {
        return false;
    }

    /**
     * 销毁
     *
     * @param sendCode
     * @return
     */
    protected boolean destroy(SendCodeDto sendCode) {
        return true;
    }

    public boolean process(SendCodeDto sendCodeDto) {
        return vail(sendCodeDto) && send(sendCodeDto) && destroy(sendCodeDto);
    }
}
